package com.xudow.app.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.HorizontalScrollView;

/**
 * 课表横向滚动
 *
 * @author lukecheng
 */
public class ClassScheduleHScrollView extends HorizontalScrollView {

    public interface ScrollChangeListener {
        void onScrollChanged(int l, int t, int oldl, int oldt);
    }

    private ScrollChangeListener scrollChangeListener;

    public void setScrollChangeListener(ScrollChangeListener listener) {
        scrollChangeListener = listener;
    }

    public ClassScheduleHScrollView(Context context) {
        super(context);
    }

    public ClassScheduleHScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ClassScheduleHScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);

        if (null != scrollChangeListener) {
            scrollChangeListener.onScrollChanged(l, t, oldl, oldt);
        }
    }
}
